class Stack {
    mainStack = new Array();
    minStack = new Array();
    push(element) {
        this.mainStack.push(element);
        if (this.minStack.length === 0 || element <= this.getMin()) {
            this.minStack.push(element);
        }
    }
    pop() {
        if (this.mainStack[0] === this.getMin()) {
            this.minStack.shift();
        }
        return this.mainStack.shift();
    }
    getMin() {
        return this.minStack[0];
    }
}

const stack = new Stack();
stack.push(4);
stack.push(9);
stack.push(7);
stack.push(3);
stack.push(8);
stack.push(5);
stack.push(100);
stack.pop();
console.log(stack.mainStack);
console.log(stack.minStack);
console.log(stack.getMin());
